#!/bin/sh
#
# Shell script to run the feature checks:
# a series of small programs that use particular features of the Fortran standard
# or certain run-time features that may or may not work with a particular compiler
#
# Note:
# This is the shell script version. It requires a shell script "compile" that
# builds a program from a given Fortran source file. For instance:
#
# compile:
# gfortran -o $1.exe $1.f90 $2 $3 $4 $5 $6 $7 $8 $9
#
# where $1 is the name of the source file (no extension) and $2 any additional flags
#
# Note: the executable program should have the extension .exe to make it easy to clean
# up the work directory
#
# Steps:
# - Clean up (no .exe files)
# - Build the auxiliary program that writes the dedicated batchfile and shell script
#   to build and run the various feature checking programs
# - Run this program
# - Run the batchfile or shell script
#

echo Start checking procedure ...

if [ "$1" == "" ]; then
    echo Note:
    echo No compiler options given
else
    echo Note:
    echo Compiler options: $1 $2 $3 $4 $5 $6 $7 $8
fi

rm -f *.exe

./compile buildscript

./buildscript.exe
chmod +x runfeatures.sh

./runfeatures.sh $1 $2 $3 $4 $5 $6 $7 $8 >features.out 2>&1

echo Done - results in features.out
